package com.nasarius.bank.scorecard.dao.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;
import org.springframework.stereotype.Repository;

import com.ibatis.sqlmap.client.SqlMapClient;
import com.nasarius.bank.scorecard.dao.TopicsDAO;
import com.nasarius.bank.scorecard.domain.Topics;
import com.nasarius.bank.scorecard.domain.TopicsExample;
@Repository
public class TopicsDAOImpl extends SqlMapClientDaoSupport implements TopicsDAO {

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table Topics
     *
     * @ibatorgenerated Sun Apr 08 16:47:06 CEST 2012
     */
	@Autowired
    public TopicsDAOImpl(/*@Qualifier("sqlMapClient")*/SqlMapClient sqlMapClient) {
        super();
        setSqlMapClient(sqlMapClient);
    }

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table Topics
     *
     * @ibatorgenerated Sun Apr 08 16:47:06 CEST 2012
     */
    public int countTopicsByExample(TopicsExample example) {
        Integer count = (Integer)  getSqlMapClientTemplate().queryForObject("topics.ibatorgenerated_countByExample", example);
        return count;
    }

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table Topics
     *
     * @ibatorgenerated Sun Apr 08 16:47:06 CEST 2012
     */
    public int deleteTopicsByExample(TopicsExample example) {
        int rows = getSqlMapClientTemplate().delete("topics.ibatorgenerated_deleteByExample", example);
        return rows;
    }

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table Topics
     *
     * @ibatorgenerated Sun Apr 08 16:47:06 CEST 2012
     */
    public int deleteTopicsByPrimaryKey(Integer topicid) {
        Topics key = new Topics();
        key.setTopicid(topicid);
        int rows = getSqlMapClientTemplate().delete("topics.ibatorgenerated_deleteByPrimaryKey", key);
        return rows;
    }

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table Topics
     *
     * @ibatorgenerated Sun Apr 08 16:47:06 CEST 2012
     */
    public void insertTopics(Topics record) {
        getSqlMapClientTemplate().insert("topics.ibatorgenerated_insert", record);
    }

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table Topics
     *
     * @ibatorgenerated Sun Apr 08 16:47:06 CEST 2012
     */
    public void insertTopicsSelective(Topics record) {
        getSqlMapClientTemplate().insert("topics.ibatorgenerated_insertSelective", record);
    }

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table Topics
     *
     * @ibatorgenerated Sun Apr 08 16:47:06 CEST 2012
     */
    @SuppressWarnings("unchecked")
	public List<Topics> selectAllTopics() {
		 List<Topics> list = getSqlMapClientTemplate().queryForList("topics.ibatorgenerated_selectAll");
	        return list;
	}

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table Topics
     *
     * @ibatorgenerated Sun Apr 08 16:47:06 CEST 2012
     */
    public Topics selectTopicsByPrimaryKey(Integer topicid) {
        Topics key = new Topics();
        key.setTopicid(topicid);
        Topics record = (Topics) getSqlMapClientTemplate().queryForObject("topics.ibatorgenerated_selectByPrimaryKey", key);
        return record;
    }
    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table Topics
     *
     * @ibatorgenerated Sun Apr 08 16:47:06 CEST 2012
     */
    public int updateTopicsByPrimaryKeySelective(Topics record) {
        int rows = getSqlMapClientTemplate().update("topics.ibatorgenerated_updateByPrimaryKeySelective", record);
        return rows;
    }

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table Topics
     *
     * @ibatorgenerated Sun Apr 08 16:47:06 CEST 2012
     */
    public int updateTopicsByPrimaryKey(Topics record) {
        int rows = getSqlMapClientTemplate().update("topics.ibatorgenerated_updateByPrimaryKey", record);
        return rows;
    }
}